<?php


namespace app\common\model;

use think\Db;

class User {

    public function getUserDataByUsername($username){
        $sql =  "select * from user where username = :username";
        return Db::query($sql,['username'=>$username]);
    }

    public function add($username, $password, $isAdmin=0){
        $sql =  "insert into user (username, password, is_admin) VALUE (:username, :password, :isAdmin) ";
        return Db::execute($sql,['username'=>$username,'password'=>$password,'isAdmin'=>$isAdmin]);
    }


}